/** 工单部门接收人 */
import request from '@/utils/request'

// 查询所有
export function getDeptReceiverAll() {
  return request({
    method: 'GET',
    url: `/call-center/api/v2/workOrderDeptReceiver/`
  })
}

// 查询指定数据
export function getDeptReceiverById(id) {
  return request({
    method: 'GET',
    url: `/call-center/api/v2/workOrderDeptReceiver/${id}`
  })
}

/** 新增/编辑保存
 * @param {String} businessType 一级业务类型code
 * @param {String} businessTypeName 一级业务类型name
 * @param {String} businessTypeTwo 二级业务类型Code
 * @param {String} businessTypeTwoName 二级业务类型Name
 * @param {String} dept 部门
 * @param {String} deptName
 * @param {String} postCode 岗位
 * @param {String} postName
 * @param {String} qupOrganization QUP组织
 * @param {String} qupOrganizationName
 * @param {String} platformCode 电商平台
 * @param {String} platformName
 * @param {String} storeCode 电商店铺
 * @param {String} storeName
 * @param {String} receiver 接收人
 * @param {String} receiverName 接收姓名
 * @param {String} receiverPhone 接收人电话
 * @param {String} remark 备注
 */
export function saveDeptReceiver(data) {
  return request({
    method: data.id ? 'PUT' : 'POST',
    url: '/call-center/api/v2/workOrderDeptReceiver',
    data
  })
}

/** 删除
 * @param {String} id 关联ID
 */
export function deleteDeptReceiver(id) {
  return request({
    method: 'DELETE',
    url: `/call-center/api/v2/workOrderDeptReceiver/${id}`
  })
}

/** 批量删除
 * @param {Array} ids 关联ID集合
 */
export function deleteBatch(ids) {
  return request({
    method: 'DELETE',
    url: `/call-center/api/v2/workOrderDeptReceiver/deleteBatch`,
    data: ids
  })
}

/** 单条数据停用/ 启用
 * @param {String} id
 * @param {Number} state 状态：1 启用 ， 0 停用
 */
export function updateStatus(id, state) {
  return request({
    method: 'PUT',
    url: `/call-center/api/v2/workOrderDeptReceiver/${state === 1 ? 'enable' : 'disable'}/${id}`
  })
}

/** 批量停用/ 启用
 * @param {Array} ids ID集合
 * @param {Number} state 状态：1 启用 ， 0 停用
 */
export function updateBatchStatus(ids, state) {
  return request({
    method: 'PUT',
    url: `/call-center/api/v2/workOrderDeptReceiver/${state === 1 ? 'enable' : 'disable'}`,
    data: ids
  })
}
